package com.yunhe.java.day05;

/**
 * Created by Administrator on 2017/7/25 0025.
 */
public class Arr1 {
    public static void main(String[] args) {
        int[] arr1 = {1, 3, 5, 6, 7, 8, 9, 0};
        fanZhuan(arr1);
        for (int i = 0; i < arr1.length; i++) {
            System.out.print(arr1[i] + " ");
        }
    }
    public static void fanZhuan(int [] arr) {
        int left = 0;
        int right = arr.length - 1;
        for (int i = 0; i < arr.length; i++) {
            if (left < right) {
                int temp = arr[left];
                arr[left] = arr[right];
                arr[right] = temp;
                left++;
                right--;
            } else {
                break;
            }
        }
    }
}
